package com.suixuan.support.log;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Component;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;

/**
 * 
 * Nanjing ZhouSu co.,Ltd
 * 
 * @Title : ControlLoggerBeanInterceptor.java
 * @Package : com.suixuan.log
 * @Description ：
 * @Date ： 2010-7-22上午09:33:29
 * @Author : suixuan
 * @Version : v 1.0
 */
@Component("controlLoggerBeanInterceptor")
public class ControlLoggerBeanInterceptor extends HandlerInterceptorAdapter {

	private String requestURI = null;
	private static String contextPath = null;
	private static LogFactoryControlThread logFactoryControlThread = LogFactoryControlThread
			.getInstance();

	@Override
	public boolean preHandle(HttpServletRequest request,
			HttpServletResponse response, Object handler) throws Exception {
		if (null == contextPath) {
			contextPath = request.getContextPath();
		}
		requestURI = request.getRequestURI();
		logFactoryControlThread.put(new Object[] { requestURI, handler,
				contextPath });
		return super.preHandle(request, response, handler);
	}

}
